package cn.xej.test;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @author Herman.Wang
 * @version $ Id: FactoryConfig.java, v 0.1 Herman Exp $
 * @date 2021-11-22 15:09:21
 */
@Configuration
public class FactoryConfig {

    @Bean
    public ProductFactory setProductFactory(List<ProductModelService> productModelServices){
        DefaultProductFactory productFactory = new DefaultProductFactory();
        for (ProductModelService productModelService : productModelServices) {
            productFactory.registerProductService(productModelService.getType(), productModelService);
        }
        return null;
    }

}
